<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="a">按钮</div>
    <script>
      //   document.write("hello world");
      var text = document.getElementById("a");
      text.onclick = function () {
        alert("你点击了这个按钮");
      };
      localStorage.setItem("a", 1);
    </script>
  </body>
</html>
